// 基于template/src/widgets/{{appEntities}}/{{ctrls@GRID}}-grid/{{spinalCase ctrl.codeName}}-grid-model.ts.hbs生成
import { IGridModel, IParam, isEmpty, VerifyUtil } from '@/core';

function getModel(): IGridModel {
	return {
		cssName: '',
		aggMode: 'NONE',
		caption: '',
		controlType: 'GRID',
		codeName: 'Usr0302075506',
		columns: getGridColumns(),
		dataItems: getGridDataItems(),
		dataExport: getDataExport(),
		enableRowEdit: false,
		entityCodeName: 'Sys_person',
		entityLogicName: '人员',
		createDefaultItems: getCreateDefaultItems(),
		updateDefaultItems: getUpdateDefaultItems(),
		name: 'grid',
		noSort: false,
		rules: {
			//	静态值规则
			staticRules: {},
			//	编辑项值规则
			editRules: [],
		},
		showHeader: true,
		sortDir: '',
		sortField: '',
		limit: 20,
		dataImport: {
			codeName: 'DataImport',
			ignoreError: false,
			importItems: [
				{
					name: 'display_name',
					caption: App.ts('', '名称'),
					fieldCodeName: 'display_name',
				},
				{
					name: 'uid',
					caption: App.ts('', '登录名'),
					fieldCodeName: 'uid',
				},
				{
					name: 'identification_number',
					caption: App.ts('', '证件号'),
					fieldCodeName: 'identification_number',
				},
				{
					name: 'title',
					caption: App.ts('', '职位'),
					fieldCodeName: 'title',
				},
				{
					name: 'postal_address',
					caption: App.ts('', '地址'),
					fieldCodeName: 'postal_address',
				},
				{
					name: 'mobile',
					caption: App.ts('', '移动电话'),
					fieldCodeName: 'mobile',
				},
				{
					name: 'telephone_number',
					caption: App.ts('', '联系电话'),
					fieldCodeName: 'telephone_number',
				},
				{
					name: 'mail',
					caption: App.ts('', '电子邮箱'),
					fieldCodeName: 'mail',
				},
				{
					name: 'employee_type',
					caption: App.ts('', '类型'),
					fieldCodeName: 'employee_type',
				},
				{
					name: 'employee_number',
					caption: App.ts('', '人员编号'),
					fieldCodeName: 'employee_number',
				},
				{
					name: 'description',
					caption: App.ts('', '描述'),
					fieldCodeName: 'description',
				},
				{
					name: 'organization_id',
					caption: App.ts('', '组织机构'),
					codeListTag: 'ad__Sys_all_organization',
					fieldCodeName: 'organization_id',
				},
				{
					name: 'id',
					caption: App.ts('', '主键标识(不填则自动生成)'),
					fieldCodeName: 'id',
				},
			],
		},
		paging: {
			defaultPageSize: 20,
		},
		uiEngineModel: [
			{
				name: 'engine_grid',
				triggerType: 'CTRLEVENT',
				logicType: 'APPVIEWENGINE',
				eventNames: 'ROWDBLCLICK;SELECTIONCHANGE;REMOVE;LOAD;BEFORELOAD',
				scriptCode: ``,
				entityCodeName: '',
				logicName: ``,
			},
		],
	};
}
//  获取所有表格列模型
function getGridColumns(): IParam[] {
	return [
		{
			align: 'left',
			codeName: 'employee_number',
			caption: '人员编号',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'employee_number',
			dataIndex: 'employee_number',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '人员编号',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'employee_number',
			width: 200,
			minWidth: 200,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'uid',
			caption: 'uid/loginname',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'uid',
			dataIndex: 'uid',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: 'uid/loginname',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'uid',
			width: 250,
			minWidth: 250,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'display_name',
			caption: '名称',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'display_name',
			dataIndex: 'display_name',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '名称',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'display_name',
			minWidth: 150,
			width: 150,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'mobile',
			caption: '移动电话',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'mobile',
			dataIndex: 'mobile',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '移动电话',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'mobile',
			width: 200,
			minWidth: 200,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'title',
			caption: '职位',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'title',
			dataIndex: 'title',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '职位',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'title',
			width: 180,
			minWidth: 180,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'mail',
			caption: '电子邮箱',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'mail',
			dataIndex: 'mail',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '电子邮箱',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'mail',
			width: 180,
			minWidth: 180,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'telephone_number',
			caption: '联系电话',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'telephone_number',
			dataIndex: 'telephone_number',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '联系电话',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'telephone_number',
			width: 180,
			minWidth: 180,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'identification_number',
			caption: '证件号',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'identification_number',
			dataIndex: 'identification_number',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '证件号',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'identification_number',
			width: 200,
			minWidth: 200,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'organization_name',
			caption: '组织机构名称',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'organization_name',
			dataIndex: 'organization_name',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '组织机构名称',
			headerCssName: '',
			show: false,
			hiddenDataItem: false,
			name: 'organization_name',
			width: 150,
			minWidth: 150,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'organization_id',
			caption: '组织机构标识',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'organization_id',
			dataIndex: 'organization_id',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '组织机构标识',
			headerCssName: '',
			show: false,
			hiddenDataItem: false,
			name: 'organization_id',
			width: 150,
			minWidth: 150,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'id',
			caption: '标识',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'id',
			dataIndex: 'id',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '标识',
			headerCssName: '',
			show: false,
			hiddenDataItem: false,
			name: 'id',
			width: 150,
			minWidth: 150,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'center',
			codeName: 'uagridcolumn1',
			caption: '操作',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'UAGRIDCOLUMN',
			dataItemName: 'uagridcolumn1',
			dataIndex: 'uagridcolumn1',
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: false,
			excelCaption: '',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'uagridcolumn1',
			width: 200,
			minWidth: 200,
			fixed: 'right',
			valueFormat: '',
			uIActionDetails: [
				{
					name: 'u5422b6b',
					caption: '编辑',
					showIcon: true,
					showCaption: true,
					separator: false,
					uIActionTag: 'UpdatePerson',
					noPrivDisplayMode: 2,
					dataAccessAction: '',
					actionTarget: 'SINGLEKEY',
					uIActionMode: 'FRONT',
					disabled: false,
					visible: true,
					logic: {
						name: 'grid_uagridcolumn1_u5422b6b_click',
						actionTag: 'UpdatePerson',
						actionDECodeName: 'Sys_person',
						predefinedType: '',
					},
					iconClass: 'fa fa-edit',
				},
				{
					name: 'ucee8221',
					caption: '查看角色',
					showIcon: true,
					showCaption: true,
					separator: false,
					uIActionTag: 'viewAuth',
					noPrivDisplayMode: 2,
					dataAccessAction: '',
					actionTarget: 'SINGLEKEY',
					uIActionMode: 'FRONT',
					disabled: false,
					visible: true,
					logic: {
						name: 'grid_uagridcolumn1_ucee8221_click',
						actionTag: 'viewAuth',
						actionDECodeName: 'Sys_person',
						predefinedType: '',
					},
					iconClass: 'fa fa-share-alt',
				},
			],
		},
	];
}

//  获取所有表格数据项
function getGridDataItems() {
	return [
		{
			name: 'employee_number',
			codeName: '',
			customCode: false,
			fieldCodeName: 'employee_number',
			fieldName: 'employee_number',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'uid',
			codeName: '',
			customCode: false,
			fieldCodeName: 'uid',
			fieldName: 'uid',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'display_name',
			codeName: '',
			customCode: false,
			fieldCodeName: 'display_name',
			fieldName: 'display_name',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'mobile',
			codeName: '',
			customCode: false,
			fieldCodeName: 'mobile',
			fieldName: 'mobile',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'title',
			codeName: '',
			customCode: false,
			fieldCodeName: 'title',
			fieldName: 'title',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'mail',
			codeName: '',
			customCode: false,
			fieldCodeName: 'mail',
			fieldName: 'mail',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'telephone_number',
			codeName: '',
			customCode: false,
			fieldCodeName: 'telephone_number',
			fieldName: 'telephone_number',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'identification_number',
			codeName: '',
			customCode: false,
			fieldCodeName: 'identification_number',
			fieldName: 'identification_number',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'organization_name',
			codeName: '',
			customCode: false,
			fieldCodeName: 'organization_name',
			fieldName: 'organization_name',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'organization_id',
			codeName: '',
			customCode: false,
			fieldCodeName: 'organization_id',
			fieldName: 'organization_id',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'id',
			codeName: '',
			customCode: false,
			fieldCodeName: 'id',
			fieldName: 'id',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'srfkey',
			codeName: '',
			customCode: false,
			fieldCodeName: 'id',
			fieldName: 'id',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'srfdataaccaction',
			codeName: '',
			customCode: false,
			fieldCodeName: 'id',
			fieldName: 'id',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'mdepartment_id',
			codeName: '',
			customCode: false,
			fieldCodeName: 'mdepartment_id',
			fieldName: 'mdepartment_id',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'srfmajortext',
			codeName: '',
			customCode: false,
			fieldCodeName: 'display_name',
			fieldName: 'display_name',
			valueFormat: '',
			dataType: '25',
		},
	];
}

function getDataExport() {
	return {
		default: true,
		codeName: 'default',
		enableFront: true,
		fileName: '人员',
		exportItems: [
			{
				name: 'employee_number',
				label: '人员编号',
				labelLanResTag: '',
				dataType: 25,
				show: true,
			},
			{
				name: 'uid',
				label: 'uid/loginname',
				labelLanResTag: '',
				dataType: 25,
				show: true,
			},
			{
				name: 'display_name',
				label: '名称',
				labelLanResTag: '',
				dataType: 25,
				show: true,
			},
			{
				name: 'mobile',
				label: '移动电话',
				labelLanResTag: '',
				dataType: 25,
				show: true,
			},
			{
				name: 'title',
				label: '职位',
				labelLanResTag: '',
				dataType: 25,
				show: true,
			},
			{
				name: 'mail',
				label: '电子邮箱',
				labelLanResTag: '',
				dataType: 25,
				show: true,
			},
			{
				name: 'telephone_number',
				label: '联系电话',
				labelLanResTag: '',
				dataType: 25,
				show: true,
			},
			{
				name: 'identification_number',
				label: '证件号',
				labelLanResTag: '',
				dataType: 25,
				show: true,
			},
			{
				name: 'organization_name',
				label: '组织机构名称',
				labelLanResTag: '',
				dataType: 25,
				show: false,
			},
			{
				name: 'organization_id',
				label: '组织机构标识',
				labelLanResTag: '',
				dataType: 25,
				show: false,
			},
			{
				name: 'id',
				label: '标识',
				labelLanResTag: '',
				dataType: 25,
				show: false,
			},
		],
	};
}

function getCreateDefaultItems() {
	return [];
}

function getUpdateDefaultItems() {
	return [];
}

export const model = getModel();
